home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / faxd / FaxMachineInfo.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  5KB  |  131 lines

  1. /*    $Header: /usr/people/sam/fax/faxd/RCS/FaxMachineInfo.h,v 1.16 1994/03/14 21:24:25 sam Rel $ */
  2. /*
  3.  * Copyright (c) 1990, 1991, 1992, 1993, 1994 Sam Leffler
  4.  * Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and 
  7.  * its documentation for any purpose is hereby granted without fee, provided
  8.  * that (i) the above copyright notices and this permission notice appear in
  9.  * all copies of the software and related documentation, and (ii) the names of
  10.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  11.  * publicity relating to the software without the specific, prior written
  12.  * permission of Sam Leffler and Silicon Graphics.
  13.  * 
  14.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  15.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  16.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  17.  * 
  18.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  22.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  23.  * OF THIS SOFTWARE.
  24.  */
  25. #ifndef _FaxMachineInfo_
  26. #define    _FaxMachineInfo_
  27. /*
  28.  * Fax Machine Information Database Support.
  29.  */
  30. #include <stdio.h>
  31. #include "Str.h"
  32.  
  33. /*
  34.  * Each remote machine the server sends a facsimile to
  35.  * has information that describes capabilities that are
  36.  * important in formatting outgoing documents, and, potentially,
  37.  * controls on what the server should do when presented
  38.  * with documents to send to the destination.  The capabilities
  39.  * are treated as a cache; information is initialized to
  40.  * be a minimal set of capabilities that all machines are
  41.  * required (by T.30) to support and then updated according
  42.  * to the DIS/DTC messages received during send operations.
  43.  */
  44. class FaxMachineCtlInfo {
  45. private:
  46.     fxStr    rejectNotice;        // if set, reject w/ this notice
  47.     int        tracingLevel;        // destination-specific tracing
  48.     // XXX time-of-day restrictions
  49.  
  50.     static const fxStr ctlDir;
  51. protected:
  52.     FaxMachineCtlInfo();
  53.  
  54.     void restore(const fxStr& number);
  55. public:
  56.     virtual ~FaxMachineCtlInfo();
  57.  
  58.     virtual const fxStr& getRejectNotice() const;
  59.     fxBool getTracingLevel(int&) const;
  60. };
  61.  
  62. class FaxMachineInfo : public FaxMachineCtlInfo {
  63. private:
  64.     FILE*    fp;            // open file
  65.     u_int    locked;            // bit vector of locked items
  66.     fxBool    changed;        // changed since restore
  67.     fxBool    supportsHighRes;    // capable of 7.7 line/mm vres
  68.     fxBool    supports2DEncoding;    // handles Group 3 2D
  69.     fxBool    supportsPostScript;    // handles Adobe NSF protocol
  70.     fxBool    calledBefore;        // successfully called before
  71.     short    maxPageWidth;        // max capable page width
  72.     short    maxPageLength;        // max capable page length
  73.     short    maxSignallingRate;    // max capable signalling rate
  74.     short    minScanlineTime;    // min scanline time capable
  75.     fxStr    csi;            // last received CSI
  76.     fxStr    jobInProgress;        // jobid of send in progress
  77.     fxStr    rejectNotice;        // status of last completed call
  78.     int        sendFailures;        // count of failed send attempts
  79.     int        dialFailures;        // count of failed dial attempts
  80.     fxStr    lastSendFailure;    // reason for last failed send attempt
  81.     fxStr    lastDialFailure;    // reason for last failed dial attempt
  82.  
  83.     static const fxStr infoDir;
  84.  
  85.     void restore();
  86.     void update();
  87. public:
  88.     FaxMachineInfo(const fxStr& number, fxBool block);
  89.     ~FaxMachineInfo();
  90.  
  91.     int operator==(const FaxMachineInfo&) const;
  92.     int operator!=(const FaxMachineInfo&) const;
  93.  
  94.     fxBool isBusy() const             { return fp == NULL; }
  95.  
  96.     fxBool getSupportsHighRes() const         { return supportsHighRes; }
  97.     fxBool getSupports2DEncoding() const     { return supports2DEncoding; }
  98.     fxBool getSupportsPostScript() const     { return supportsPostScript; }
  99.     fxBool getCalledBefore() const         { return calledBefore; }
  100.     int getMaxPageWidth() const             { return maxPageWidth; }
  101.     int getMaxPageLength() const         { return maxPageLength; }
  102.     int getMaxSignallingRate() const         { return maxSignallingRate; }
  103.     int getMinScanlineTime() const         { return minScanlineTime; }
  104.     const fxStr& getCSI() const          { return csi; }
  105.  
  106.     const fxStr& getJobInProgress() const    { return jobInProgress; }
  107.     virtual const fxStr& getRejectNotice() const;
  108.     int getSendFailures() const            { return sendFailures; }
  109.     int getDialFailures() const            { return dialFailures; }
  110.     const fxStr& getLastSendFailure() const    { return lastSendFailure; }
  111.     const fxStr& getLastDialFailure() const    { return lastDialFailure; }
  112.  
  113.     void setSupportsHighRes(fxBool);
  114.     void setSupports2DEncoding(fxBool);
  115.     void setSupportsPostScript(fxBool);
  116.     void setCalledBefore(fxBool);
  117.     void setMaxPageWidth(int);
  118.     void setMaxPageLength(int);
  119.     void setMaxSignallingRate(int);
  120.     void setMinScanlineTime(int);
  121.     void setCSI(const fxStr&);
  122.  
  123.     void setJobInProgress(const fxStr&);
  124.     void setRejectNotice(const fxStr&);
  125.     void setSendFailures(int);
  126.     void setDialFailures(int);
  127.     void setLastSendFailure(const fxStr&);
  128.     void setLastDialFailure(const fxStr&);
  129. };
  130. #endif /* _FaxMachineInfo_ */
  131.